Table Inventory
Inventory manipulation
Functions
GiveItem(objectID[, count][, addToPickupSummary]) | Add an item to the player's inventory. |
TakeItem(Object[, count]) | Remove an item from the player's inventory. |
GetItemCount(objectID) | Get the amount of an item held in the player's inventory. |
SetItemCount(objectID, count) | Set the amount of an item in the player's inventory. |
GetUsedItem() | Get last item used in the player's inventory. |
SetUsedItem(objectID) | Set last item used in the player's inventory. |
ClearUsedItem() | Clear last item used in the player's inventory. |
Functions
- GiveItem(objectID[, count][, addToPickupSummary])
-
Add an item to the player's inventory.
Parameters:
- objectID ObjID Object ID of the item to add.
- count int The amount of items to add. Default is the yield from a single pickup, e.g. 1 from a medipack, 12 from a flare pack. (optional)
- addToPickupSummary bool If true, display the item in the pickup summary. Default is false. (optional)
- TakeItem(Object[, count])
-
Remove an item from the player's inventory.
Parameters:
- Object ObjID ID of the item to remove.
- count int The amount of items to remove. Default is the yield from a single pickup, e.g. 1 from a medipack, 12 from a flare pack. (optional)
- GetItemCount(objectID)
-
Get the amount of an item held in the player's inventory.
Parameters:
- objectID ObjID Object ID of the item to check.
Returns:
-
int
The amount of items. -1 indicates infinity.
- SetItemCount(objectID, count)
-
Set the amount of an item in the player's inventory.
Parameters:
- objectID ObjID Object ID of the item amount to set.
- count int The amount of items to set. -1 indicates infinity.
- GetUsedItem()
-
Get last item used in the player's inventory.
This value will be valid only for a single frame after exiting inventory, after which Lara says "No".
Therefore, this function must be preferably used either in OnLoop or OnUseItem events.
Returns:
-
ObjID
Last item used in the inventory.
- SetUsedItem(objectID)
-
Set last item used in the player's inventory.
You will be able to specify only objects which already exist in the inventory.
Will only be valid for the next frame. If not processed by the game, Lara will say "No".
Parameters:
- objectID ObjID Object ID of the item to select from inventory.
- ClearUsedItem()
- Clear last item used in the player's inventory. When this function is used in OnUseItem level function, it allows to override existing item functionality. For items without existing functionality, this function is needed to avoid Lara saying "No" after using it.